
from llm_func import *

import warnings

import pandas as pd
warnings.filterwarnings("ignore")


loan_type = 'NonProjectLoan'
# js_arr = pd.read_excel('./data2.xlsx',sheet_name=loan_type).to_dict(orient='records')
#
js_arr = [{"projectId": "3c555f42f3364c2194f82832c99efee4", "projectType": "NonProjectLoan",
       "loanPurpose": '购买风力发电设备'
          , "industryName": '森林改培','projectName':'a'}]
# js_arr = [{"projectId": "3c555f42f3364c2194f82832c99efee3", "projectType": "ProjectLoan",
#        "loanPurpose": '测试一下识别，我是做光伏发电的'
#           , "industryName": '褐煤开采洗选','projectName':'a'}]
import sys
# print(rs)

loan_type = 'NonProjectLoan'
#
# lst = pd.read_excel('./银行100条数据测试结果0220-无行业策略.xlsx').projectId.to_list()
# lst2 = pd.read_excel('./data2.xlsx',sheet_name=loan_type).projectId.to_list()
# ls = [id for id in lst2 if id not in lst]
# print(len(ls))
# js_arr = pd.read_excel('./data2.xlsx',sheet_name=loan_type)
# js_arr = js_arr.loc[js_arr.projectId.isin(ls)].to_dict(orient='records')  #.loc[[0]]
# # js = js[0]
print(js_arr)
print(len(js_arr))

 # dft.to_excel('./大模型结果样例.xlsx')
final = GetLLMresult(js_arr)
print(final)
final.to_excel('结果样例.xlsx')
# datas = final.to_json(orient='records', force_ascii=False)
# print(datas)
# final.to_excel('./0225-20条纯绿行业策略.xlsx')
#%%

# from llm_func3 import *
# loan_type = 'ProjectLoan'
# rs = pd.read_excel('./rs.xlsx')
# rs = RecommendLLM(rs)
# rs = map_other_result(rs, loan_type)



# #%%
# import pandas as pd
# rs = pd.read_excel('./推荐函数输入数据.xlsx')
#
# def RecommendLLM(rs):
#     print('开始推荐',file=sys.stderr)
#     dft = pd.read_excel('./llmFile/行业限定策略表.xlsx', sheet_name='四级行业推荐')
#
#     js = rs.to_dict(orient='records')[0]
#
#     if js['industry_china'] is None:
#         js['industry_china'] = ''
#
#     js['Recommend'] = dft.loc[dft.industry == js['industry_china'], 'y'].to_list()
#     if js['class_top1'] in js['Recommend']:
#         js['Recommend'].remove(js['class_top1'])
#
#     if js['class_top2'] in js['Recommend']:
#         js['Recommend'].remove(js['class_top2'])
#
#     if js['class_top3'] in js['Recommend']:
#         js['Recommend'].remove(js['class_top3'])
#
#     rs = pd.DataFrame([js])
#     print('推荐结束',file=sys.stderr)
#     return rs
#
# r = RecommendLLM(rs)